
<script>

export default {

  created () {
    // 调用API从本地缓存中获取数据
    /*
     * 平台 api 差异的处理方式:  api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
     * 微信：mpvue === wx, mpvuePlatform === 'wx'
     * 头条：mpvue === tt, mpvuePlatform === 'tt'
     * 百度：mpvue === swan, mpvuePlatform === 'swan'
     * 支付宝(蚂蚁)：mpvue === my, mpvuePlatform === 'my'
     */

    let logs
    if (mpvuePlatform === 'my') {
      logs = mpvue.getStorageSync({key: 'logs'}).data || []
      logs.unshift(Date.now())
      mpvue.setStorageSync({
        key: 'logs',
        data: logs
      })
    } else {
      logs = mpvue.getStorageSync('logs') || []
      logs.unshift(Date.now())
      mpvue.setStorageSync('logs', logs)
    }
  },
  log () {
    console.log(`log at:${Date.now()}`)
  },
  onShow: function(options) {
			// console.log('App Show')
      // console.log(options.shareTicket)
      // getApp().globalData.shareTicket = options.shareTicket
    },
  onLaunch: function () {
    var that = this
    that.globalData.loginId = 1
    console.log(that.globalData.openid,'onshow')
    wx.getSystemInfo({
      success (res) {
        console.log(res)
        that.statusBarHeight = res.statusBarHeight*2
        that.platform = res.platform
        let platformReg = /ios/i;
        if (platformReg.test(that.platform)) {
            that.titleBarHeight = 88;
        } else {
            that.titleBarHeight = 96;
        }
        that.navBarHeight = that.statusBarHeight + that.titleBarHeight;
        console.log(that.navBarHeight)
      }
    })
    // var that=this
    // wx.login({
    //   success: res => {
    //     // 发送 res.code 到后台换取 openId, sessionKey, unionId
    //     wx.request({
    //         url: 'https://api.weixin.qq.com/sns/jscode2session', //仅为示例，并非真实的接口地址
    //         data: {
    //           appid:'wxe37bb24c693151f6',
    //           secret:'d3f6be1f2de58205a895fa312a998516',
    //           js_code:res.code,
    //           grant_type:'authorization_code'
    //         },
    //         method:'GET',
    //         header: {
    //           'content-type': 'application/json' // 默认值
    //         },
    //         success (res) {
    //           console.log(res)
    //           if(res.statusCode==200){
    //             that.globalData.openid = res.data.openid
    //             that.globalData.session_key = res.data.session_key
    //           }
    //         }
    //       })
    //     }
    //   })
    // wx.checkSession({
    //     success () {
    //       //session_key 未过期，并且在本生命周期一直有效
    //        wx.switchTab({
    //         url:'/pages/index/main'
    //       })
    //     },
    //     fail () {
    //       // session_key 已经失效，需要重新执行登录流程
    //       wx.login() //重新登录
    //     }
    //   })
    }
}

</script>

<style>
  checkbox .wx-checkbox-input {
		border-radius: 50%;
		background: none;
	}

	checkbox .wx-checkbox-input.wx-checkbox-input-checked {
		border: 1px solid rgba(255, 85, 85, 1);
		background: rgba(255, 85, 85, 1);
		color: #fff !important;
	}

	checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
		font-size: 32px;
	}
  
.container {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 200rpx 0;
  box-sizing: border-box;
}
/* this rule will be remove */
* {
  transition: width 2s;
  -moz-transition: width 2s;
  -webkit-transition: width 2s;
  -o-transition: width 2s;
}
.value-class {
  flex: none !important;
}
.nav_class{
  color: red !important    
}


.scrool::-webkit-scrollbar {display:none}
</style>
